﻿using UnityEngine;
using System.Collections;

public class GameOverScreen : Networking {

	Vector2 _slightPadding = new Vector2(Screen.width * 0.025f,Screen.height * 0.05f); 
	Rect _area, leftArea, middleArea; 
	// Use this for initialization
	void Start () {
		postScore (PlayerPrefs.GetInt("score"));
		getScores ();
		base.Start ();		
	}
	void OnGUI() 	
	{ 
		base.OnGUI ();
		_area = new Rect(0,0 , Screen.width, Screen.height); 
		leftArea = new Rect(_slightPadding.x,_slightPadding.y,_area.width * 0.3f,_area.height);
		GUI.Box(_area, "", customSkin.customStyles[0]);
		middleArea = new Rect(_area.width*0.32f + _slightPadding.x,_slightPadding.y,_area.width * 0.63f,_area.height);
		GUI.BeginGroup(_area); 	
		GUI.BeginGroup(leftArea); 	
		GUI.Box(new Rect(0,0,leftArea.width,leftArea.height*0.9f),"Stats", UIBox); 
		if (GUI.Button (new Rect (leftArea.width / 6, leftArea.height * 0.6f, leftArea.width / 1.5f, leftArea.height * 0.3f - _slightPadding.y), "Try Again?", customSkin.button)) {
			Application.LoadLevel("mainScene");
				}
		GUI.EndGroup(); 		GUI.BeginGroup(middleArea);
		GUI.Box(new Rect(0,0,middleArea.width,middleArea.height*0.9f),"Leaderboards", UIBox); 	
		GUI.Button(new Rect(_slightPadding.x,_slightPadding.y +  middleArea.height * 0.05f,middleArea.width * 0.3f, middleArea.height * 0.1f),"Top Players"  , customSkin.button); 
		GUI.Button(new Rect(_slightPadding.x + (middleArea.width*0.3f),_slightPadding.y +  middleArea.height * 0.05f,middleArea.width * 0.3f, middleArea.height * 0.1f),"Your Rank",customSkin.button); 
		GUI.Button(new Rect(_slightPadding.x + (middleArea.width*0.6f),_slightPadding.y +  middleArea.height * 0.05f,middleArea.width * 0.3f, middleArea.height * 0.1f),"Friends",customSkin.button); 	
		LeaderBoard(new Rect(0,_slightPadding.y + middleArea.height * 0.15f, middleArea.width * 0.95f, middleArea.height * 0.65f),12); 	
		GUI.EndGroup(); 
		GUI.EndGroup(); 
	} 	


	// Update is called once per frame
	void Update () {
	
	}
}
